package com.hospital.demo.controller.zhangweibo;


import com.hospital.demo.model.zhangweibo.Financemanage;
import com.hospital.demo.service.zhangweibo.FinancemanageService;
import com.hospital.demo.util.ResultUtils;
import com.hospital.demo.util.ResultVO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

@Api(tags = "财务管理接口")
@CrossOrigin
@RestController
@RequestMapping("/FinancemanageController")

public class FinancemanageController {
    @Autowired
    FinancemanageService financemanageService;

    @ApiOperation("查询全部财务记录")
    @GetMapping("/SelectAllFM")
    public ResultVO SelectAllFM(Integer page, Integer limit) {

        List<Financemanage> lists = financemanageService.SelectAllFM();

        return ResultUtils.success(lists);
    }

    @ApiOperation("删除记录")
    @PostMapping("/DelectFM")
    public Map<String, Object> DelectFM(Integer fmid) {
        Map<String, Object> map = new HashMap<>();
        Integer Flag = financemanageService.DelectFM(fmid);
        if (Flag == 1) {
            map.put("msg", "删除操作成功");
        } else {
            map.put("msg", "删除操作失败");
        }
        return map;
    }
}
